struct Light
{
	float4 direction;
	float4 colour;
	float4 ambient;
	float4 position;
	float4 attenuation;
	float2 pad1;
	float range;
	int enabled;
};

cbuffer ConstantBuffer : register( b0 )
{
	float4 TEST;
	matrix World;
	matrix View;
	matrix Projection;
	matrix LightViewMatrix;
	matrix LightProjMatrix;
	Light light[3];
	float4 OutputColour;
	float2 TexturePositionOne;
	float2 TexturePositionTwo;
	float3 CameraPosition;
}
//--------------------------------------------------------------------------------------
struct VS_INPUT // = PS_INPUT
{
    float4 Pos : POSITION;
    float2 TexCoord : TEXCOORD0;
	float3 Normal : NORMAL0;
	float3 Tangent : TANGENT;
	float3 Binormal : BINORMAL;
};

struct PS_INPUT
{
	float4 Pos : SV_POSITION;
	float2 TexCoord : TEXCOORD0;
	float3 Normal : NORMAL0;
};

PS_INPUT VS(VS_INPUT input)
{
    PS_INPUT output = (PS_INPUT)0;

    output.Pos = mul( input.Pos, World );
	//output.Pos.x += 0.025f;
    //output.Pos = mul( output.Pos, View );
    //output.Pos = mul( output.Pos, Projection );
	
	//output.Normal = mul(input.Normal, World);
	output.TexCoord = input.TexCoord;

    return output;
}

Texture2D ObjTexture : register( t0 );
SamplerState ObjSamplerState : register( s0 );

float4 PS(PS_INPUT input) : SV_Target
{
	float blurAmnt = 0.002f;
	//return OutputColour;
	float2 tex0 = input.TexCoord;
	float2 tex1 = float2(input.TexCoord.x, input.TexCoord.y + blurAmnt);
	float2 tex2 = float2(input.TexCoord.x + blurAmnt, input.TexCoord.y);
	float2 tex3 = float2(input.TexCoord.x, input.TexCoord.y - blurAmnt);
	float2 tex4 = float2(input.TexCoord.x - blurAmnt, input.TexCoord.y);
	float2 tex5 = float2(input.TexCoord.x + blurAmnt, input.TexCoord.y + blurAmnt);
	float2 tex6 = float2(input.TexCoord.x - blurAmnt, input.TexCoord.y - blurAmnt);

	float4 img0 = ObjTexture.Sample(ObjSamplerState, tex0);
	float4 img1 = ObjTexture.Sample(ObjSamplerState, tex1);
	float4 img2 = ObjTexture.Sample(ObjSamplerState, tex2);
	float4 img3 = ObjTexture.Sample(ObjSamplerState, tex3);
	float4 img4 = ObjTexture.Sample(ObjSamplerState, tex4);
	float4 img5 = ObjTexture.Sample(ObjSamplerState, tex5);
	float4 img6 = ObjTexture.Sample(ObjSamplerState, tex6);

	float4 finalCol = img0 * 1.0f;
	finalCol += img1 * 0.66f;
	finalCol += img2 * 0.33f;
	finalCol += img3 * 0.11f;
	finalCol += img4 * 0.33f;
	finalCol += img5 * 0.66f;
	finalCol += img6 * 1.0f;

	finalCol = 0;
	if (img0.r == 0.0f)
	{
		finalCol = float4(0.0f, 0.0f, 0.0f, 0.0f);
	}
	else
	{
		finalCol = float4(0.0f, 0.0f, 0.0f, 1.0f);
	}

	return img0;

	//return float4(ObjTexture.Sample(ObjSamplerState, input.TexCoord).xyz, 0.5f);
}